<?php


namespace app\api\controller;


use app\api\model\HealthClassifyModel;
use app\api\model\HealthKindModel;
use app\api\model\HealthTopicModel;
use app\api\model\UserAdminBMessageModel;
use app\common\controller\Api;

class MyReport extends Api
{
    protected $noNeedLogin = [];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function cateList()
    {
        $list = HealthClassifyModel::where(['pid' => 0, 'is_show' => 1])->order('sort desc')->select();

        $this->success('请求成功', $list);
    }

    public function fileList()
    {
        $class_id = input('post.class_id');

        $list = HealthTopicModel::all(['class_id'=>$class_id,'is_show'=>1,'user_id'=>$this->auth->id]);

        $this->success('请求成功',$list);
    }

    public function sheetList()
    {
        $topic_id = input('post.topic_id');

        $kindModel = new HealthKindModel();

        $list = $kindModel->where(['topic_id'=>$topic_id,'is_show'=>1])->group('sheet')->column('id,remark,sheet');

        $this->success('请求成功',$list);
    }

    /*
     * 获取后台导入的报告对比分析列表
     */
    public function bMessageList()
    {
        $limit = input('post.limit');

        $messageModel = new UserAdminBMessageModel();

        $list = $messageModel->where(['user_id'=>$this->auth->id])->where('content','neq','')->order('id desc')->paginate($limit);

        $this->success('请求成功',$list);

    }

    /*
     * 获取报告对比分析详情
     */
    public function bMessageDetail()
    {
        $id = input('post.id');

        $messageModel = new UserAdminBMessageModel();

        $detail = $messageModel::get($id);

        $this->success('请求成功',$detail);
    }



}